﻿using RgUtility.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
namespace WanWebApplication
{
    
    public class WebHelperForClient
    {
        /// <summary>
        /// 弹窗
        /// </summary>
        /// <param name="page"></param>
        /// <param name="msg"></param>
        public static void Alert(Page page, string msg)
        {
            page.ClientScript.RegisterClientScriptBlock(page.GetType(), "Alert", "<script type=\"text/javascript\" defer=\"false\">alert(\"" + msg + "\");</script>", false);
            
        }
        /// <summary>
        /// 刷新
        /// </summary>
        /// <param name="page"></param>
        /// <param name="msg"></param>
        /// <param name="locationUrl">刷新的Url,null则调用Reload</param>
        public static void RefreshDoc(Page page, string locationUrl)
        {
            if (!string.IsNullOrEmpty(locationUrl))
                page.ClientScript.RegisterClientScriptBlock(page.GetType(), "RefreshDoc", "<script type=\"text/javascript\" defer=\"false\"> document.location=\"" + locationUrl + "\"</script>", false);
            else
                page.ClientScript.RegisterClientScriptBlock(page.GetType(), "RefreshDoc", "<script type=\"text/javascript\" defer=\"false\"> document.location.reload();</script>", false);
        }
    }
}